package com.mathlearning.auth.repository;

import com.mathlearning.auth.entity.Chapter;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ChapterRepository extends JpaRepository<Chapter, Long> {
    
    /**
     * 根据课程ID查询章节列表（按order_num排序）
     */
    List<Chapter> findByCourseIdOrderByOrderNumAsc(Long courseId);
    
    /**
     * 统计课程下的章节数量
     */
    long countByCourseId(Long courseId);
}








